package com.github.cyf.config.minio;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenyifan
 * @create 2024-03-16 13:53
 */
@Configuration
@RequiredArgsConstructor
public class MinioConfig {

    private final MinioProperties minioProperties;

    @Bean
    public MinioClient getMinioClient() {
        MinioClient client = MinioClient.builder()
                // Minio服务所在地址
                .endpoint(minioProperties.getEndpoint())
                // 账号，密码
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
        return client;
    }

}
